package com.scalar.chiptrack.operations.finishedGoods.actionCommands;

import com.scalar.chiptrack.ChipTrackExtendedAction;
import com.scalar.chiptrack.commons.Constants;

/**
 * User: Murali Krishna Yengala
 * Date: May 27, 2005
 * Time: 11:43:13 AM
 */
public class FinishedGoodsActionCommandFactory implements Constants{

    private static FinishedGoodsActionCommandFactory sFgcfactory;

    public synchronized static FinishedGoodsActionCommandFactory getInstance()
    {
        if ( sFgcfactory == null )
        {
            sFgcfactory = new FinishedGoodsActionCommandFactory();
        }
        return sFgcfactory;
    }

    private FinishedGoodsActionCommandFactory()
    {
    }

    /**
     * Returns the ActionCommand Class that implements businnes logic for the given action
     *
     * @param action
     * @return
     */
    public static ChipTrackExtendedAction getActionCommand( String action )
    {
        if ( ACTION_SEARCH.equalsIgnoreCase( action ) )
        {
            return new FinishedGoodsSearchActionCommand();
        }
        if ( ACTION_NEW.equalsIgnoreCase( action ) )
        {
            return new FinishedGoodsCommand();
        }
        if ( "newEntry".equalsIgnoreCase( action ) )
        {
            return new FinishedGoodsNewEntryCommand();
        }
        if( "addMoreDupPartsForNewFg".equalsIgnoreCase( action ) )
        {
            return new FinishedGoodsEquivalentPartsAddMoreCommand();
        }
        if( "confirmNewFg".equalsIgnoreCase( action ) )
        {
            return new FinishedGoodsNewConfirmCommand();
        }
        if( "saveNewFg".equalsIgnoreCase( action ) )
        {
            return new FinishedGoodsNewEntrySaveCommand();
        }
        if("viewFg".equalsIgnoreCase( action ) )
        {
            return new FinishedGoodsLoadCommand();
        }
        if("editFg".equalsIgnoreCase( action ) )
        {
            return new FinishedGoodsLoadCommand();
        }
        if( "saveEditFg".equalsIgnoreCase( action))
        {
            return new FinishedGoodsUpdateCommand();
        }
        if( "confirmEditFg".equalsIgnoreCase( action ))
        {
            return new FinishedGoodsModifyConfirmCommand();
        }
        if( "addMoreDupPartsForEditFg".equalsIgnoreCase( action))
        {
            return new FinishedGoodsEquivalentPartsAddMoreCommand();            
        }
        if( ACTION_EDIT.equalsIgnoreCase( action ))
        {
            return new FinishedGoodsEditCommand();
        }
        if( "saveAlgorithmName".equalsIgnoreCase( action ))
        {
            return new FinishedGoodsSaveAlgorithmCommand();
        }
        if( "reload".equalsIgnoreCase( action ))
        {
            return new FinishedGoodsReloadCommand();
        }
        return null;
    }
}
